/*function SetRating(imgvar, starsCount){
    var number = Math.round(starsCount);
    if (number !== 0) {
        if (!$(imgvar).parent().find("span").hasClass("hidden"))
            $(imgvar).parent().find("span").addClass("hidden");
        if (!$(imgvar).hasClass("hidden")) {
            $(imgvar).removeClass("hidden");
        }
        $(imgvar).attr("src", "../../images/rating/star" + number + ".png");
    } else {
        $(imgvar).addClass("hidden");
        $(imgvar).parent().find("span").removeClass("hidden");
    }
}*/

function a_click(clicked_item, id)
{
    switch (clicked_item)
    {
        case 1:

            if (document.getElementById("hotels" + id).style.display == "block") {

                document.getElementById("hotels" + id).style.display = "none";
                document.getElementById('hotel_details_tab' + id).style.background = "url(images/tab.png)";
                document.getElementById('hotel_details_tab' + id).style.opacity = "0.4";
                document.getElementById('hotel_details_tab' + id).style.backgroundSize = "100% 100%";
                document.getElementById('hotels_tb' + id).style.color = "#fff";
                document.getElementById("tb_hotel_hidden" + id).value = 0;
				document.getElementById('room_details_tab' + id).style.backgroundPosition = "-2px 0px";
            }
            else
            {

                document.getElementById("hotels" + id).style.display = "block";
                document.getElementById('hotel_details_tab' + id).style.background = "url(images/tab_hover.png)";
                document.getElementById('hotel_details_tab' + id).style.opacity = "1";
                document.getElementById('hotel_details_tab' + id).style.backgroundSize = "106% 100%";
                document.getElementById('hotels_tb' + id).style.color = "#000";
                document.getElementById("tb_hotel_hidden" + id).value = 1;
				document.getElementById('room_details_tab' + id).style.backgroundPosition = "-2px 0px";

            }

            document.getElementById("rooms" + id).style.display = "none";
            document.getElementById("galery" + id).style.display = "none";


			document.getElementById('room_details_tab' + id).style.backgroundPosition = "-2px 0px";
			document.getElementById('room_details_tab'+id).style.background="url(images/tab.png)";
			document.getElementById('room_details_tab'+id).style.opacity="0.8";
			document.getElementById('room_details_tab'+id).style.backgroundSize="106% 100%";
            document.getElementById('room_tb' + id).style.color = "#fff";

            document.getElementById('galery_tab' + id).style.background = "url(images/tab.png)";
            document.getElementById('galery_tab' + id).style.opacity = "0.4";
            document.getElementById('galery_tab' + id).style.backgroundSize = "106% 100%";
            document.getElementById('galery_tb' + id).style.color = "#fff";


            document.getElementById("tb_room_hidden" + id).value = 0;
            document.getElementById("tb_galery_hidden" + id).value = 0;





            break;

        case 2:

            document.getElementById("hotels" + id).style.display = "none";

            if (document.getElementById("rooms" + id).style.display == "block") {
                document.getElementById("rooms" + id).style.display = "none"
                document.getElementById('room_details_tab' + id).style.background = "url(images/tab.png)";
                document.getElementById('room_details_tab' + id).style.opacity = "0.8";
                document.getElementById('room_details_tab' + id).style.backgroundSize = "106% 100%";
				document.getElementById('room_details_tab' + id).style.backgroundPosition = "-2px 0px";
                document.getElementById('room_tb' + id).style.color = "#fff";
                document.getElementById("tb_room_hidden" + id).value = 0;
            } else {
                document.getElementById("rooms" + id).style.display = "block"
                document.getElementById('room_details_tab' + id).style.background = "url(images/tab_hover.png)";
                document.getElementById('room_details_tab' + id).style.opacity = "1";
                document.getElementById('room_details_tab' + id).style.backgroundSize = "106% 100%";
				document.getElementById('room_details_tab' + id).style.backgroundPosition = "-2px 0px";
                document.getElementById('room_tb' + id).style.color = "#000";
                //document.getElementById("tb_room_hidden" + id).value = 1;
            }

            document.getElementById("galery" + id).style.display = "none";
            document.getElementById('hotel_details_tab' + id).style.background = "url(images/tab.png)";
            document.getElementById('hotel_details_tab' + id).style.opacity = "0.4";
            document.getElementById('hotel_details_tab' + id).style.backgroundSize = "106% 100%";
            document.getElementById('hotels_tb' + id).style.color = "#fff";
            document.getElementById('galery_tab' + id).style.background = "url(images/tab.png)";
            document.getElementById('galery_tab' + id).style.opacity = "0.4";
            document.getElementById('galery_tab' + id).style.backgroundSize = "100% 100%";
            document.getElementById('galery_tb' + id).style.color = "#fff";
            document.getElementById("tb_hotel_hidden" + id).value = 0;
            document.getElementById("tb_galery_hidden" + id).value = 0;
			
			document.getElementById('room_details_tab'+id).style.background="url(images/tab.png)";
			document.getElementById('room_details_tab'+id).style.opacity="0.8";
			document.getElementById('room_details_tab'+id).style.backgroundSize="106% 100%";
			document.getElementById('room_details_tab' + id).style.backgroundPosition = "-2px 0px";
            document.getElementById('room_tb' + id).style.color = "#fff";
			
            break;

        default:
            document.getElementById("hotels" + id).style.display = "none";
            document.getElementById("rooms" + id).style.display = "none";

            if (document.getElementById("galery" + id).style.display == "block") {

                document.getElementById("galery" + id).style.display = "none";
                document.getElementById('galery_tab' + id).style.background = "url(images/tab.png)";
                document.getElementById('galery_tab' + id).style.opacity = "0.4";
                document.getElementById('galery_tab' + id).style.backgroundSize = "106% 100%";
                document.getElementById('galery_tb' + id).style.color = "#fff";
                document.getElementById("tb_galery_hidden" + id).value = 0;
            }
            else
            {
                document.getElementById("galery" + id).style.display = "block";
                document.getElementById('galery_tab' + id).style.background = "url(images/tab_hover.png)";
                document.getElementById('galery_tab' + id).style.opacity = "1";
                document.getElementById('galery_tab' + id).style.backgroundSize = "106% 100%";
                document.getElementById('galery_tb' + id).style.color = "#000";
                document.getElementById("tb_galery_hidden" + id).value = 1;

            }
            document.getElementById('hotel_details_tab' + id).style.background = "url(images/tab.png)";
            document.getElementById('hotel_details_tab' + id).style.opacity = "0.4";
            document.getElementById('hotel_details_tab' + id).style.backgroundSize = "106% 100%";
            document.getElementById('hotels_tb' + id).style.color = "#fff";

			document.getElementById('room_details_tab'+id).style.background="url(images/tab.png)";
			document.getElementById('room_details_tab'+id).style.opacity="0.8";
			document.getElementById('room_details_tab'+id).style.backgroundSize="106% 100%";
            document.getElementById('room_tb' + id).style.color = "#fff";
			document.getElementById('room_details_tab' + id).style.backgroundPosition = "-2px 0px";


            document.getElementById("tb_hotel_hidden" + id).value = 0;
            document.getElementById("tb_room_hidden" + id).value = 0;



    }


}


function a_hover(item_hovered, id)
{
    switch (item_hovered)
    {
        case 1:
            if (document.getElementById("tb_hotel_hidden" + id).value != 1)
            {
                document.getElementById("hotels_tb" + id).style.color = "#000";
                document.getElementById("hotels_tb" + id).style.textDecoration = "none";
                document.getElementById("hotels_tb" + id).style.fontWeight = "bold";
                document.getElementById("hotels_tb" + id).style.fontFamily = "Arial, Helvetica, sans-serif";
                document.getElementById("hotel_details_tab" + id).style.background = "url(images/tab_hover.png)";
                document.getElementById("hotel_details_tab" + id).style.opacity = "0.4";
                document.getElementById("hotel_details_tab" + id).style.backgroundSize = "100% 100%";
                document.getElementById("hotel_details_tab" + id).style.padding = "10px";
            }
            break;

//		case 2:
//			if(document.getElementById("tb_room_hidden"+id).value!=1)
//			{
//				document.getElementById("room_tb"+id).style.color="#000";
//				document.getElementById("room_tb"+id).style.textDecoration="none";
//				document.getElementById("room_tb"+id).style.fontWeight="bold";
//				document.getElementById("room_tb"+id).style.fontFamily="Arial, Helvetica, sans-serif";
////				document.getElementById("room_details_tab"+id).style.background="url(images/tab_hover.png)";
////				document.getElementById("room_details_tab"+id).style.opacity="1";
////				document.getElementById("room_details_tab"+id).style.backgroundSize="100% 100%";
////				document.getElementById("room_details_tab"+id).style.padding="10px";
//			}
//
//		break;

        default:
            if (document.getElementById("tb_galery_hidden" + id).value != 1)
            {
                document.getElementById("galery_tb" + id).style.color = "#000";
                document.getElementById("galery_tb" + id).style.textDecoration = "none";
                document.getElementById("galery_tb" + id).style.fontWeight = "bold";
                document.getElementById("galery_tb" + id).style.fontFamily = "Arial, Helvetica, sans-serif";
                document.getElementById("galery_tab" + id).style.background = "url(images/tab_hover.png)";
                document.getElementById("galery_tab" + id).style.opacity = "0.4";
                document.getElementById("galery_tab" + id).style.backgroundSize = "100% 100%";
                document.getElementById("galery_tab" + id).style.padding = "10px";
            }
    }
}


function a_mouseout(item_mouseout, id)
{
    switch (item_mouseout)
    {
        case 1:
            //console.log(document.getElementById("tb_hotel_hidden"+id));
            //console.log("tb_hotel_hidden"+id);
            if (document.getElementById("tb_hotel_hidden" + id).value != 1)
            {
                document.getElementById("hotels_tb" + id).style.color = "#fff";
                document.getElementById("hotels_tb" + id).style.textDecoration = "none";
                document.getElementById("hotels_tb" + id).style.fontWeight = "bold";
                document.getElementById("hotels_tb" + id).style.fontFamily = "Arial, Helvetica, sans-serif";

                document.getElementById("hotel_details_tab" + id).style.background = "url(images/tab.png)";
                document.getElementById("hotel_details_tab" + id).style.opacity = "0.4";
                document.getElementById("hotel_details_tab" + id).style.backgroundSize = "100% 100%";
                document.getElementById("hotel_details_tab" + id).style.padding = "10px";
            }
            break;
//		case 2:
//			if(document.getElementById("tb_room_hidden"+id).value!=1)
//			{
//			document.getElementById("room_tb"+id).style.color="#fff";
//			document.getElementById("room_tb"+id).style.textDecoration="none";
//			document.getElementById("room_tb"+id).style.fontWeight="bold";
//			document.getElementById("room_tb"+id).style.fontFamily="Arial, Helvetica, sans-serif";
//
////			document.getElementById("room_details_tab"+id).style.background="url(images/tab.png)";
////			document.getElementById("room_details_tab"+id).style.opacity="0.8";
////			document.getElementById("room_details_tab"+id).style.backgroundSize="100% 100%";
////			document.getElementById("room_details_tab"+id).style.padding="10px";
//			}
//		break;

        default:

            if (document.getElementById("tb_galery_hidden" + id).value != 1)
            {
                document.getElementById("galery_tb" + id).style.color = "#fff";
                document.getElementById("galery_tb" + id).style.textDecoration = "none";
                document.getElementById("galery_tb" + id).style.fontWeight = "bold";
                document.getElementById("galery_tb" + id).style.fontFamily = "Arial, Helvetica, sans-serif";

                document.getElementById("galery_tab" + id).style.background = "url(images/tab.png)";
                document.getElementById("galery_tab" + id).style.opacity = "0.4";
                document.getElementById("galery_tab" + id).style.backgroundSize = "100% 100%";
                document.getElementById("galery_tab" + id).style.padding = "10px";
            }
    }
}

////////////////////////////////////////////////////////

//Galery
/*
function show_picture(hotelId, img) {
    var link = $(img).find('img').attr('src');
    link = link.replace('_t.', '_b.');
    $('#picture' + hotelId).attr('src', link).error(
            function() {
                link = link.replace('_y.', '_b.');
                $('#picture' + hotelId).attr('src', link);
            });
}
*/
function show_picture(hotelId, img) {
    var link = $(img).find('img').attr('src');
    $('#picture_frame'+hotelId).addClass('load');
    link = link.replace('_t.', '_b.');
    $('#picture' + hotelId).attr('src', link).error(
            function() {
                link = link.replace('_y.', '_b.');
                $('#picture' + hotelId).attr('src', link);
            });
     setTimeout(function(){$('#picture_frame'+hotelId).removeClass('load');},1000);
}

function showCancelationPolicy(id)
{

    if (document.getElementById(id).style.display == "block")
    {
        document.getElementById(id).style.display = "none";
    }
    else
    {
        document.getElementById(id).style.display = "block";
    }
}